/**
 * 
 * Copyright (C) 2011 Cody Stoutenburg . All rights reserved.
 *
 *       This program is free software; you can redistribute it and/or
 *       modify it under the terms of the GNU Lesser General Public License
 *       as published by the Free Software Foundation; either version 2.1
 *       of the License, or (at your option) any later version.
 *
 *       This program is distributed in the hope that it will be useful,
 *       but WITHOUT ANY WARRANTY; without even the implied warranty of
 *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *       GNU Lesser General Public License for more details.
 *
 *       You should have received a copy of the GNU Lesser General Public License
 *       along with this program; if not, write to the Free Software
 *       Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
 * 
 */
package ca.usherbrooke.application.astar.location;

import java.util.ArrayList;

import ca.usherbrooke.application.astar.Road;
import ca.usherbrooke.tools.position.Vector2D;

/**
 * @author Cody Stoutenburg
 * 
 */
public class BasicLocation implements ILocation {
	private static final long serialVersionUID = 1L;

	private Vector2D position;
	private ArrayList<Road> roads;
	private ArrayList<ILocation> neighbor;

	private final Boolean isWall;

	public BasicLocation(Vector2D position, Boolean isWall) {
		this.position = position;

		this.roads = new ArrayList<Road>();

		this.isWall = isWall;
	}

	/*
	 * GETTER ET SETTER
	 */
	@Override
	public Vector2D getPosition() {
		return position;
	}

	public void setPosition(Vector2D position) {
		this.position = position;
	}

	@Override
	public ArrayList<Road> getRoads() {
		return roads;
	}

	@Override
	public void setRoads(ArrayList<Road> roads) {
		this.roads = roads;
	}

	@Override
	public void setNeighbor(ArrayList<ILocation> neighbor) {
		this.neighbor = neighbor;
	}

	@Override
	public ArrayList<ILocation> getNeighbor() {
		return this.neighbor;
	}

	@Override
	public Float getSpeedFactor() {
		return 1.0f;
	}

	@Override
	public Boolean isWall() {
		return isWall;
	}

	@Override
	public Boolean isEntity() {
		return false;
	}

	@Override
	public Float getDistance(ILocation location) {
		Float distance = this.getPosition().getDistance(location.getPosition());
		return distance;
	}

	@Override
	public String toString() {
		return position.toString();
	}
}
